package org.groupg.practice.jscience;

import org.jscience.mathematics.number.Real;
import org.jscience.mathematics.function.Polynomial;

public class JScienceDemo {
    public static void main(String[] args) {
        // 定义多项式 f(x) = x^2 + 2x + 3
        Polynomial<Real> poly = Polynomial.valueOf(Real.ONE, Real.valueOf(2), Real.valueOf(3));

        // 计算 f(2)
        Real x = Real.valueOf(2);
        Real result = poly.evaluate(x);
        System.out.println("f(2) = " + result); // 输出: 11.0
    }
}